Skip to content

[Moore] Add coroutine, call_coroutine ops; lower to LLHD#10069

Open
fabianschuiki wants to merge 1 commit intomainfrom
fschuiki/moore-coroutines
Open

[Moore] Add coroutine, call_coroutine ops; lower to LLHD#10069
fabianschuiki wants to merge 1 commit intomainfrom
fschuiki/moore-coroutines

Conversation

@fabianschuiki
Copy link
Copy Markdown
Contributor

Add moore.coroutine and moore.call_coroutine ops to represent SystemVerilog tasks. Tasks differ from functions in that they can suspend execution via timing controls. Update moore.return to also be valid inside coroutines.

Add MooreToCore lowering: moore.coroutine maps to llhd.coroutine, moore.call_coroutine to llhd.call_coroutine, and moore.return inside a coroutine to llhd.return.

@fabianschuiki
Copy link
Copy Markdown
Contributor Author

Results of circt-tests run for 8f20da9 compared to results for 85a7160: no change to test results.

@fabianschuiki fabianschuiki force-pushed the fschuiki/llhd-coroutines branch from 85a7160 to d676ea7 Compare March 27, 2026 22:52
@fabianschuiki fabianschuiki force-pushed the fschuiki/moore-coroutines branch from 8f20da9 to 9dfe8dc Compare March 27, 2026 22:52
Base automatically changed from fschuiki/llhd-coroutines to main March 27, 2026 23:13
Add `moore.coroutine` and `moore.call_coroutine` ops to represent
SystemVerilog tasks. Tasks differ from functions in that they can
suspend execution via timing controls. Update `moore.return` to also
be valid inside coroutines.

Add MooreToCore lowering: `moore.coroutine` maps to `llhd.coroutine`,
`moore.call_coroutine` to `llhd.call_coroutine`, and `moore.return`
inside a coroutine to `llhd.return`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fabianschuiki fabianschuiki force-pushed the fschuiki/moore-coroutines branch from 9dfe8dc to 0080246 Compare March 27, 2026 23:15
@fabianschuiki
Copy link
Copy Markdown
Contributor Author

Results of circt-tests run for 0080246 compared to results for 838a8bb:

sv-tests

Changes in emitted diagnostics:

  • -9 total change
  • -14 error: 'moore.read' op using value defined outside the region
  • -7 error: 'llhd.halt' op expects parent op to be one of 'llhd.process, llhd.final'
  • +7 error: 'llhd.halt' op expects parent op to be one of 'llhd.process, llhd.final, llhd.coroutine'
  • +7 error: 'llhd.wait' op expects parent op to be one of 'llhd.process, llhd.coroutine'
  • -4 error: 'llhd.wait' op expects parent op 'llhd.process'
  • +1 error: cannot materialize captured ref at call site; non-symbol source: moore.variable
  • +1 error: failed to legalize operation 'moore.fork'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant